<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 *公告管理
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$storeid=$this->model('store')->checklogin();
if($_RQ['op']=='list'){	
	$params=array('uniacid'=>$_SESSION['uniacid'],'id'=>$storeid);
	if(!empty($_RQ['title'])){
		$params['title like']='%'.trim($_RQ['title']).'%';
		$return['params']['title']=$_RQ['title'];
	}
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$fields=array('id','uniacid','title','status');
	$list=pdo_getslice('jy_mapfuwu_store',$params,array($pindex,$psize),$total,$fields,'','id desc');
	if($list){
		foreach($list as &$item){
			$item['star']=$this->model('store')->get_star($item['id']);
		}
	}
	$return['list']=$list;
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$htmls=array(
		'type'=>'list',		
		'list'=>array('data'=>'list','delall'=>false,'del_one'=>false,'tip'=>'[温馨提示]：设置--网点评级规则','edit'=>false,'list'=>array(
			array('name'=>'title','title'=>'门店','type'=>'string'),
			array('name'=>'star.star','title'=>'综合评级','type'=>'string'),
			array('name'=>'star.store_star','title'=>'网点评分','type'=>'string'),
			array('name'=>'star.order_star','title'=>'订单评分','type'=>'string'),
			array('name'=>'star.hs_num','title'=>'好人好事量','type'=>'string'),
			array('name'=>'star.ts_num','title'=>'投诉数量','type'=>'string'),
		)),
		'search'=>array(
			array('name'=>'title','width'=>15,'title'=>'门店名称','type'=>'string'),
		)
	);	
	$return['htmls']=$htmls;	
	exi($return);
}
